﻿using System;
using System.Data;
using Model;
using DBUtility;

namespace DAL
{
     /// <summary>
     /// 数据访问层RESULT_CHASISS_MANUAL_DAL
     /// </summary>
     public class RESULT_CHASISS_MANUAL_DAL
     {
         public RESULT_CHASISS_MANUAL_DAL()
         {
         }


         /// <summary>
         /// 得到最大JCLSH
         /// </summary>
         public string GetMax_JCLSH(string p_strWhere)
         {
             string strResult = "0";
             string strSql = "select max(JCLSH) as m from RESULT_CHASISS_MANUAL";

             if(p_strWhere.Trim().Length > 0)
             {
                 strSql += " where " + p_strWhere;
             }

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             if(dtTemp.Rows.Count>0)
             {
                 if(dtTemp.Rows[0]["m"].ToString().Length>0)
                 {
                     strResult = dtTemp.Rows[0]["m"] == DBNull.Value ? "" : dtTemp.Rows[0]["m"].ToString();
                 }
             }

             dtTemp.Dispose();

             return string.Format("{0:D50}", Convert.ToInt32(strResult) + 1);

          }

          /// <summary>
          /// 得到最大JCLSH
          /// </summary>
          public string GetMax_JCLSH()
          {
              return GetMax_JCLSH("");
          }


          /// <summary>
          /// 判断数据是否存在
          /// </summary>
          public bool Exists(string strJCLSH)
          {
               bool bolResult = false;

               if (strJCLSH == null)
               {
                   return false;
               }

               if (strJCLSH.Length == 0)
               {
                   return false;
               }

               string strSql = "";
               strSql += "select count(1) as c from RESULT_CHASISS_MANUAL";
               strSql += " where ";
               strSql += " JCLSH='"+ strJCLSH +"'";

               DataTable dtTemp = new DataTable();
               DbHelper.GetTable(strSql, ref dtTemp);

               if (dtTemp.Rows.Count > 0)
               {
                   bolResult = Convert.ToInt32(dtTemp.Rows[0]["c"]) > 0;
               }

               dtTemp.Dispose();

               return bolResult;

          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount(string p_strWhere)
          {
              int intResult=0;

              string strSql = "";
              strSql += "select count(1) as c from RESULT_CHASISS_MANUAL";
              if(p_strWhere.Trim().Length > 0)
              {
                 strSql += " where " + p_strWhere;
              }

              DataTable dtTemp = new DataTable();
              DbHelper.GetTable(strSql, ref dtTemp);

              if(dtTemp.Rows.Count>0)
              {
                  intResult=Convert.ToInt32(dtTemp.Rows[0]["c"]);
              }

              dtTemp.Dispose();

              return intResult;
          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount()
          {
              return GetRecordCount("");
          }

          /// <summary>
          /// 获取数据分页总数
           /// </summary>
          public int GetPageCount(string p_strWhere, int p_intPageSize)
          {
              int intResult=0;

              if(p_intPageSize > 0)
              {
                  int intRecordCount = GetRecordCount(p_strWhere);
                  intResult = Convert.ToInt32(Math.Truncate(Convert.ToDecimal(intRecordCount) / Convert.ToDecimal(p_intPageSize)));
                  if (intRecordCount > (intResult * p_intPageSize))
                  {
                       intResult++;
                  }
              }

              if(intResult == 0)
              {
                   intResult++;
              }
              return intResult;
           }

          /// <summary>
          /// 获取数据分页总数
          /// </summary>
          public int GetPageCount(int p_intPageSize)
          {
              return GetPageCount("", p_intPageSize);
          }

          /// <summary>
          /// 添加一条数据 SQL
          /// </summary>
          public string InsertSQL(RESULT_CHASISS_MANUAL model)
          {
              string strFieldSQL = "";
              string strValueSQL = "";

              if(model.Changed("DPBJJCCS") == true && model.DPBJJCCS != null)
              {
                   strFieldSQL += ",DPBJJCCS";
                   strValueSQL += ",'" + model.DPBJJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDPJCCS") == true && model.DTDPJCCS != null)
              {
                   strFieldSQL += ",DTDPJCCS";
                   strValueSQL += ",'" + model.DTDPJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJCJCCS") == true && model.WGJCJCCS != null)
              {
                   strFieldSQL += ",WGJCJCCS";
                   strValueSQL += ",'" + model.WGJCJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("JCLSH") == true && model.JCLSH != null)
              {
                   strFieldSQL += ",JCLSH";
                   strValueSQL += ",'" + model.JCLSH.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("RGJYBHGX") == true && model.RGJYBHGX != null)
              {
                   strFieldSQL += ",RGJYBHGX";
                   strValueSQL += ",'" + model.RGJYBHGX.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJC_PD") == true && model.WGJC_PD != null)
              {
                   strFieldSQL += ",WGJC_PD";
                   strValueSQL += ",'" + model.WGJC_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJCCZY") == true && model.WGJCCZY != null)
              {
                   strFieldSQL += ",WGJCCZY";
                   strValueSQL += ",'" + model.WGJCCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WYXRD_PD") == true && model.WYXRD_PD != null)
              {
                   strFieldSQL += ",WYXRD_PD";
                   strValueSQL += ",'" + model.WYXRD_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WYXRDJYY") == true && model.WYXRDJYY != null)
              {
                   strFieldSQL += ",WYXRDJYY";
                   strValueSQL += ",'" + model.WYXRDJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ZCGZZD_PD") == true && model.ZCGZZD_PD != null)
              {
                   strFieldSQL += ",ZCGZZD_PD";
                   strValueSQL += ",'" + model.ZCGZZD_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ZCGZZJYY") == true && model.ZCGZZJYY != null)
              {
                   strFieldSQL += ",ZCGZZJYY";
                   strValueSQL += ",'" + model.ZCGZZJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DPBJ_PD") == true && model.DPBJ_PD != null)
              {
                   strFieldSQL += ",DPBJ_PD";
                   strValueSQL += ",'" + model.DPBJ_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DPBJCZY") == true && model.DPBJCZY != null)
              {
                   strFieldSQL += ",DPBJCZY";
                   strValueSQL += ",'" + model.DPBJCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDP_PD") == true && model.DTDP_PD != null)
              {
                   strFieldSQL += ",DTDP_PD";
                   strValueSQL += ",'" + model.DTDP_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDPCZY") == true && model.DTDPCZY != null)
              {
                   strFieldSQL += ",DTDPCZY";
                   strValueSQL += ",'" + model.DTDPCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("CLTZCSJC_PD") == true && model.CLTZCSJC_PD != null)
              {
                   strFieldSQL += ",CLTZCSJC_PD";
                   strValueSQL += ",'" + model.CLTZCSJC_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("CLTZCSJCJYY") == true && model.CLTZCSJCJYY != null)
              {
                   strFieldSQL += ",CLTZCSJCJYY";
                   strValueSQL += ",'" + model.CLTZCSJCJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("AQZZJY_PD") == true && model.AQZZJY_PD != null)
              {
                   strFieldSQL += ",AQZZJY_PD";
                   strValueSQL += ",'" + model.AQZZJY_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("AQZZJYY") == true && model.AQZZJYY != null)
              {
                   strFieldSQL += ",AQZZJYY";
                   strValueSQL += ",'" + model.AQZZJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("LWCX_PD") == true && model.LWCX_PD != null)
              {
                   strFieldSQL += ",LWCX_PD";
                   strValueSQL += ",'" + model.LWCX_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("LWCXJYY") == true && model.LWCXJYY != null)
              {
                   strFieldSQL += ",LWCXJYY";
                   strValueSQL += ",'" + model.LWCXJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DGJYBHGX") == true && model.DGJYBHGX != null)
              {
                   strFieldSQL += ",DGJYBHGX";
                   strValueSQL += ",'" + model.DGJYBHGX.ToString().Replace("'","''") + "'";
              }

              string strSql = "";
              strSql += "insert into RESULT_CHASISS_MANUAL";
              strSql += "(";
              strSql += strFieldSQL.Substring(1);
              strSql += ")";
              strSql += " values";
              strSql += "(";
              strSql += strValueSQL.Substring(1);
              strSql += ")";

              return strSql;
          }

          /// <summary>
          /// 添加一条数据
          /// </summary>
          public bool Insert(RESULT_CHASISS_MANUAL model)
          {
              return DbHelper.ExecuteSql(InsertSQL(model));
          }

          /// <summary>
          /// 修改一条数据 SQL
          /// </summary>
          public string UpdateSQL(RESULT_CHASISS_MANUAL model,string strJCLSH)
          {
              string strUpdateSQL = "";

              if(model.Changed("DPBJJCCS") == true && model.DPBJJCCS != null)
              {
                  strUpdateSQL += ",DPBJJCCS='" + model.DPBJJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDPJCCS") == true && model.DTDPJCCS != null)
              {
                  strUpdateSQL += ",DTDPJCCS='" + model.DTDPJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJCJCCS") == true && model.WGJCJCCS != null)
              {
                  strUpdateSQL += ",WGJCJCCS='" + model.WGJCJCCS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("JCLSH") == true && model.JCLSH != null)
              {
                  strUpdateSQL += ",JCLSH='" + model.JCLSH.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("RGJYBHGX") == true && model.RGJYBHGX != null)
              {
                  strUpdateSQL += ",RGJYBHGX='" + model.RGJYBHGX.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJC_PD") == true && model.WGJC_PD != null)
              {
                  strUpdateSQL += ",WGJC_PD='" + model.WGJC_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WGJCCZY") == true && model.WGJCCZY != null)
              {
                  strUpdateSQL += ",WGJCCZY='" + model.WGJCCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WYXRD_PD") == true && model.WYXRD_PD != null)
              {
                  strUpdateSQL += ",WYXRD_PD='" + model.WYXRD_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("WYXRDJYY") == true && model.WYXRDJYY != null)
              {
                  strUpdateSQL += ",WYXRDJYY='" + model.WYXRDJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ZCGZZD_PD") == true && model.ZCGZZD_PD != null)
              {
                  strUpdateSQL += ",ZCGZZD_PD='" + model.ZCGZZD_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ZCGZZJYY") == true && model.ZCGZZJYY != null)
              {
                  strUpdateSQL += ",ZCGZZJYY='" + model.ZCGZZJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DPBJ_PD") == true && model.DPBJ_PD != null)
              {
                  strUpdateSQL += ",DPBJ_PD='" + model.DPBJ_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DPBJCZY") == true && model.DPBJCZY != null)
              {
                  strUpdateSQL += ",DPBJCZY='" + model.DPBJCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDP_PD") == true && model.DTDP_PD != null)
              {
                  strUpdateSQL += ",DTDP_PD='" + model.DTDP_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DTDPCZY") == true && model.DTDPCZY != null)
              {
                  strUpdateSQL += ",DTDPCZY='" + model.DTDPCZY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("CLTZCSJC_PD") == true && model.CLTZCSJC_PD != null)
              {
                  strUpdateSQL += ",CLTZCSJC_PD='" + model.CLTZCSJC_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("CLTZCSJCJYY") == true && model.CLTZCSJCJYY != null)
              {
                  strUpdateSQL += ",CLTZCSJCJYY='" + model.CLTZCSJCJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("AQZZJY_PD") == true && model.AQZZJY_PD != null)
              {
                  strUpdateSQL += ",AQZZJY_PD='" + model.AQZZJY_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("AQZZJYY") == true && model.AQZZJYY != null)
              {
                  strUpdateSQL += ",AQZZJYY='" + model.AQZZJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("LWCX_PD") == true && model.LWCX_PD != null)
              {
                  strUpdateSQL += ",LWCX_PD='" + model.LWCX_PD.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("LWCXJYY") == true && model.LWCXJYY != null)
              {
                  strUpdateSQL += ",LWCXJYY='" + model.LWCXJYY.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("DGJYBHGX") == true && model.DGJYBHGX != null)
              {
                  strUpdateSQL += ",DGJYBHGX='" + model.DGJYBHGX.ToString().Replace("'","''") + "'";
              }

               string strSql = "";
               strSql += "update RESULT_CHASISS_MANUAL set ";
               strSql += strUpdateSQL.Substring(1);
               strSql += " where ";
               strSql += " JCLSH='"+ strJCLSH +"'";

               return strSql;
          }

          /// <summary>
          /// 修改一条数据
          /// </summary>
          public bool Update(RESULT_CHASISS_MANUAL model, string strJCLSH)
          {
              return DbHelper.ExecuteSql(UpdateSQL(model, strJCLSH));
          }

          /// <summary>
          /// 修改一个集合 SQL
          /// </summary>
           public string UpdateRangeSQL(RESULT_CHASISS_MANUAL model, string p_strWhere)
          {
               string strUpdateSQL = "";

               if(model.Changed("DPBJJCCS") == true && model.DPBJJCCS != null)
               {
                  strUpdateSQL += ",DPBJJCCS='" + model.DPBJJCCS.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DTDPJCCS") == true && model.DTDPJCCS != null)
               {
                  strUpdateSQL += ",DTDPJCCS='" + model.DTDPJCCS.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("WGJCJCCS") == true && model.WGJCJCCS != null)
               {
                  strUpdateSQL += ",WGJCJCCS='" + model.WGJCJCCS.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("JCLSH") == true && model.JCLSH != null)
               {
                  strUpdateSQL += ",JCLSH='" + model.JCLSH.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("RGJYBHGX") == true && model.RGJYBHGX != null)
               {
                  strUpdateSQL += ",RGJYBHGX='" + model.RGJYBHGX.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("WGJC_PD") == true && model.WGJC_PD != null)
               {
                  strUpdateSQL += ",WGJC_PD='" + model.WGJC_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("WGJCCZY") == true && model.WGJCCZY != null)
               {
                  strUpdateSQL += ",WGJCCZY='" + model.WGJCCZY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("WYXRD_PD") == true && model.WYXRD_PD != null)
               {
                  strUpdateSQL += ",WYXRD_PD='" + model.WYXRD_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("WYXRDJYY") == true && model.WYXRDJYY != null)
               {
                  strUpdateSQL += ",WYXRDJYY='" + model.WYXRDJYY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("ZCGZZD_PD") == true && model.ZCGZZD_PD != null)
               {
                  strUpdateSQL += ",ZCGZZD_PD='" + model.ZCGZZD_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("ZCGZZJYY") == true && model.ZCGZZJYY != null)
               {
                  strUpdateSQL += ",ZCGZZJYY='" + model.ZCGZZJYY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DPBJ_PD") == true && model.DPBJ_PD != null)
               {
                  strUpdateSQL += ",DPBJ_PD='" + model.DPBJ_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DPBJCZY") == true && model.DPBJCZY != null)
               {
                  strUpdateSQL += ",DPBJCZY='" + model.DPBJCZY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DTDP_PD") == true && model.DTDP_PD != null)
               {
                  strUpdateSQL += ",DTDP_PD='" + model.DTDP_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DTDPCZY") == true && model.DTDPCZY != null)
               {
                  strUpdateSQL += ",DTDPCZY='" + model.DTDPCZY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("CLTZCSJC_PD") == true && model.CLTZCSJC_PD != null)
               {
                  strUpdateSQL += ",CLTZCSJC_PD='" + model.CLTZCSJC_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("CLTZCSJCJYY") == true && model.CLTZCSJCJYY != null)
               {
                  strUpdateSQL += ",CLTZCSJCJYY='" + model.CLTZCSJCJYY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("AQZZJY_PD") == true && model.AQZZJY_PD != null)
               {
                  strUpdateSQL += ",AQZZJY_PD='" + model.AQZZJY_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("AQZZJYY") == true && model.AQZZJYY != null)
               {
                  strUpdateSQL += ",AQZZJYY='" + model.AQZZJYY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("LWCX_PD") == true && model.LWCX_PD != null)
               {
                  strUpdateSQL += ",LWCX_PD='" + model.LWCX_PD.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("LWCXJYY") == true && model.LWCXJYY != null)
               {
                  strUpdateSQL += ",LWCXJYY='" + model.LWCXJYY.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("DGJYBHGX") == true && model.DGJYBHGX != null)
               {
                  strUpdateSQL += ",DGJYBHGX='" + model.DGJYBHGX.ToString().Replace("'","''") + "'";
               }

              string strSql = "";
              strSql += "update RESULT_CHASISS_MANUAL set ";
              strSql += strUpdateSQL.Substring(1);
              strSql += " where " + p_strWhere;

              return strSql;
          }

          /// <summary>
          /// 修改一个集合
          /// </summary>
          public bool UpdateRange(RESULT_CHASISS_MANUAL model, string p_strWhere)
          {
              return DbHelper.ExecuteSql(UpdateRangeSQL(model, p_strWhere));
          }

          /// <summary>
          /// 修改全部数据 SQL
          /// </summary>
          public string UpdateAllSQL(RESULT_CHASISS_MANUAL model)
          {
              string strUpdateSQL = "";

                  strUpdateSQL += ",DPBJJCCS='" + model.DPBJJCCS.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DTDPJCCS='" + model.DTDPJCCS.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",WGJCJCCS='" + model.WGJCJCCS.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",JCLSH='" + model.JCLSH.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",RGJYBHGX='" + model.RGJYBHGX.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",WGJC_PD='" + model.WGJC_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",WGJCCZY='" + model.WGJCCZY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",WYXRD_PD='" + model.WYXRD_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",WYXRDJYY='" + model.WYXRDJYY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",ZCGZZD_PD='" + model.ZCGZZD_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",ZCGZZJYY='" + model.ZCGZZJYY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DPBJ_PD='" + model.DPBJ_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DPBJCZY='" + model.DPBJCZY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DTDP_PD='" + model.DTDP_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DTDPCZY='" + model.DTDPCZY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",CLTZCSJC_PD='" + model.CLTZCSJC_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",CLTZCSJCJYY='" + model.CLTZCSJCJYY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",AQZZJY_PD='" + model.AQZZJY_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",AQZZJYY='" + model.AQZZJYY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",LWCX_PD='" + model.LWCX_PD.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",LWCXJYY='" + model.LWCXJYY.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",DGJYBHGX='" + model.DGJYBHGX.ToString().Replace("'","''") + "'";


               string strSql = "";
               strSql += "update RESULT_CHASISS_MANUAL set ";
               strSql += strUpdateSQL.Substring(1);

               return strSql;

          }

          /// <summary>
          /// 修改全部数据
          /// </summary>
          public bool UpdateAll(RESULT_CHASISS_MANUAL model)
          {
              return DbHelper.ExecuteSql(UpdateAllSQL(model));
          }

          /// <summary>
          /// 删除一条数据 SQL
          /// </summary>
          public string DeleteSQL(string strJCLSH)
          {
              string strSql = "";
              strSql += "delete from RESULT_CHASISS_MANUAL";
              strSql += " where ";
               strSql += " JCLSH='"+ strJCLSH +"'";

              return strSql;

          }

          /// <summary>
          /// 删除一条数据
          /// </summary>
          public bool Delete(string strJCLSH)
          {
              return DbHelper.ExecuteSql(DeleteSQL(strJCLSH));
          }

          /// <summary>
          /// 删除一个集合 SQL
          /// </summary>
          public string DeleteRangeSQL(string p_strWhere)
          {
              string strSql = "";
              strSql += "delete from RESULT_CHASISS_MANUAL";
              strSql += " where " + p_strWhere;

              return strSql;
           }

          /// <summary>
          /// 删除一个集合
          /// </summary>
          public bool DeleteRange(string p_strWhere)
          {
              return DbHelper.ExecuteSql(DeleteRangeSQL(p_strWhere));
          }

          /// <summary>
          /// 删除全部 SQL
          /// </summary>
          public string DeleteAllSQL()
          {
              string strSql = "";
              strSql += "delete from RESULT_CHASISS_MANUAL";

              return strSql;
           }

         /// <summary>
         /// 删除全部
         /// </summary>
         public bool DeleteAll()
         {
             return DbHelper.ExecuteSql(DeleteAllSQL());
         }

          /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public RESULT_CHASISS_MANUAL GetModel(string strJCLSH)
         {
             string strSql = "";
             strSql += "select * from RESULT_CHASISS_MANUAL";
             strSql += " where ";
               strSql += " JCLSH='"+ strJCLSH +"'";

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             RESULT_CHASISS_MANUAL model = new RESULT_CHASISS_MANUAL();

             if(dtTemp.Rows.Count>0)
             {
                 model = new RESULT_CHASISS_MANUAL();

                 model.ID = dtTemp.Rows[0]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["ID"]);
                 model.DPBJJCCS = dtTemp.Rows[0]["DPBJJCCS"] == DBNull.Value ? "" : dtTemp.Rows[0]["DPBJJCCS"].ToString();
                 model.DTDPJCCS = dtTemp.Rows[0]["DTDPJCCS"] == DBNull.Value ? "" : dtTemp.Rows[0]["DTDPJCCS"].ToString();
                 model.WGJCJCCS = dtTemp.Rows[0]["WGJCJCCS"] == DBNull.Value ? "" : dtTemp.Rows[0]["WGJCJCCS"].ToString();
                 model.JCLSH = dtTemp.Rows[0]["JCLSH"] == DBNull.Value ? "" : dtTemp.Rows[0]["JCLSH"].ToString();
                 model.RGJYBHGX = dtTemp.Rows[0]["RGJYBHGX"] == DBNull.Value ? "" : dtTemp.Rows[0]["RGJYBHGX"].ToString();
                 model.WGJC_PD = dtTemp.Rows[0]["WGJC_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["WGJC_PD"].ToString();
                 model.WGJCCZY = dtTemp.Rows[0]["WGJCCZY"] == DBNull.Value ? "" : dtTemp.Rows[0]["WGJCCZY"].ToString();
                 model.WYXRD_PD = dtTemp.Rows[0]["WYXRD_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["WYXRD_PD"].ToString();
                 model.WYXRDJYY = dtTemp.Rows[0]["WYXRDJYY"] == DBNull.Value ? "" : dtTemp.Rows[0]["WYXRDJYY"].ToString();
                 model.ZCGZZD_PD = dtTemp.Rows[0]["ZCGZZD_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["ZCGZZD_PD"].ToString();
                 model.ZCGZZJYY = dtTemp.Rows[0]["ZCGZZJYY"] == DBNull.Value ? "" : dtTemp.Rows[0]["ZCGZZJYY"].ToString();
                 model.DPBJ_PD = dtTemp.Rows[0]["DPBJ_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["DPBJ_PD"].ToString();
                 model.DPBJCZY = dtTemp.Rows[0]["DPBJCZY"] == DBNull.Value ? "" : dtTemp.Rows[0]["DPBJCZY"].ToString();
                 model.DTDP_PD = dtTemp.Rows[0]["DTDP_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["DTDP_PD"].ToString();
                 model.DTDPCZY = dtTemp.Rows[0]["DTDPCZY"] == DBNull.Value ? "" : dtTemp.Rows[0]["DTDPCZY"].ToString();
                 model.CLTZCSJC_PD = dtTemp.Rows[0]["CLTZCSJC_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["CLTZCSJC_PD"].ToString();
                 model.CLTZCSJCJYY = dtTemp.Rows[0]["CLTZCSJCJYY"] == DBNull.Value ? "" : dtTemp.Rows[0]["CLTZCSJCJYY"].ToString();
                 model.AQZZJY_PD = dtTemp.Rows[0]["AQZZJY_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["AQZZJY_PD"].ToString();
                 model.AQZZJYY = dtTemp.Rows[0]["AQZZJYY"] == DBNull.Value ? "" : dtTemp.Rows[0]["AQZZJYY"].ToString();
                 model.LWCX_PD = dtTemp.Rows[0]["LWCX_PD"] == DBNull.Value ? "" : dtTemp.Rows[0]["LWCX_PD"].ToString();
                 model.LWCXJYY = dtTemp.Rows[0]["LWCXJYY"] == DBNull.Value ? "" : dtTemp.Rows[0]["LWCXJYY"].ToString();
                 model.DGJYBHGX = dtTemp.Rows[0]["DGJYBHGX"] == DBNull.Value ? "" : dtTemp.Rows[0]["DGJYBHGX"].ToString();
             }

             dtTemp.Dispose();

             return model;
         }

         /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public void GetModel(ref DataTable p_dtData, string strJCLSH)
         {
             p_dtData.Clear();

             string strSql = "";
             strSql += "select * from RESULT_CHASISS_MANUAL";
             strSql += " where ";
               strSql += " JCLSH='"+ strJCLSH +"'";

              DbHelper.GetTable(strSql, ref p_dtData);
         }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList(string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
               m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
               m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
               m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from RESULT_CHASISS_MANUAL";
          if(p_strWhere.Trim().Length > 0)
          {
               strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
               strSql += " order by " + p_strOrder;
          }

          DataTable dtTemp = new DataTable();

          if(p_intPageSize > 0)
          {
               DbHelper.GetTable(strSql, ref dtTemp, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
               DbHelper.GetTable(strSql, ref dtTemp);
          }

          RESULT_CHASISS_MANUAL[] arrModel=new RESULT_CHASISS_MANUAL[dtTemp.Rows.Count];

          for(int N=0;N<dtTemp.Rows.Count;N++)
          {
               arrModel[N] = new RESULT_CHASISS_MANUAL();

                 arrModel[N].ID = dtTemp.Rows[N]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["ID"]);
                 arrModel[N].DPBJJCCS = dtTemp.Rows[N]["DPBJJCCS"] == DBNull.Value ? "" : dtTemp.Rows[N]["DPBJJCCS"].ToString();
                 arrModel[N].DTDPJCCS = dtTemp.Rows[N]["DTDPJCCS"] == DBNull.Value ? "" : dtTemp.Rows[N]["DTDPJCCS"].ToString();
                 arrModel[N].WGJCJCCS = dtTemp.Rows[N]["WGJCJCCS"] == DBNull.Value ? "" : dtTemp.Rows[N]["WGJCJCCS"].ToString();
                 arrModel[N].JCLSH = dtTemp.Rows[N]["JCLSH"] == DBNull.Value ? "" : dtTemp.Rows[N]["JCLSH"].ToString();
                 arrModel[N].RGJYBHGX = dtTemp.Rows[N]["RGJYBHGX"] == DBNull.Value ? "" : dtTemp.Rows[N]["RGJYBHGX"].ToString();
                 arrModel[N].WGJC_PD = dtTemp.Rows[N]["WGJC_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["WGJC_PD"].ToString();
                 arrModel[N].WGJCCZY = dtTemp.Rows[N]["WGJCCZY"] == DBNull.Value ? "" : dtTemp.Rows[N]["WGJCCZY"].ToString();
                 arrModel[N].WYXRD_PD = dtTemp.Rows[N]["WYXRD_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["WYXRD_PD"].ToString();
                 arrModel[N].WYXRDJYY = dtTemp.Rows[N]["WYXRDJYY"] == DBNull.Value ? "" : dtTemp.Rows[N]["WYXRDJYY"].ToString();
                 arrModel[N].ZCGZZD_PD = dtTemp.Rows[N]["ZCGZZD_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["ZCGZZD_PD"].ToString();
                 arrModel[N].ZCGZZJYY = dtTemp.Rows[N]["ZCGZZJYY"] == DBNull.Value ? "" : dtTemp.Rows[N]["ZCGZZJYY"].ToString();
                 arrModel[N].DPBJ_PD = dtTemp.Rows[N]["DPBJ_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["DPBJ_PD"].ToString();
                 arrModel[N].DPBJCZY = dtTemp.Rows[N]["DPBJCZY"] == DBNull.Value ? "" : dtTemp.Rows[N]["DPBJCZY"].ToString();
                 arrModel[N].DTDP_PD = dtTemp.Rows[N]["DTDP_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["DTDP_PD"].ToString();
                 arrModel[N].DTDPCZY = dtTemp.Rows[N]["DTDPCZY"] == DBNull.Value ? "" : dtTemp.Rows[N]["DTDPCZY"].ToString();
                 arrModel[N].CLTZCSJC_PD = dtTemp.Rows[N]["CLTZCSJC_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["CLTZCSJC_PD"].ToString();
                 arrModel[N].CLTZCSJCJYY = dtTemp.Rows[N]["CLTZCSJCJYY"] == DBNull.Value ? "" : dtTemp.Rows[N]["CLTZCSJCJYY"].ToString();
                 arrModel[N].AQZZJY_PD = dtTemp.Rows[N]["AQZZJY_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["AQZZJY_PD"].ToString();
                 arrModel[N].AQZZJYY = dtTemp.Rows[N]["AQZZJYY"] == DBNull.Value ? "" : dtTemp.Rows[N]["AQZZJYY"].ToString();
                 arrModel[N].LWCX_PD = dtTemp.Rows[N]["LWCX_PD"] == DBNull.Value ? "" : dtTemp.Rows[N]["LWCX_PD"].ToString();
                 arrModel[N].LWCXJYY = dtTemp.Rows[N]["LWCXJYY"] == DBNull.Value ? "" : dtTemp.Rows[N]["LWCXJYY"].ToString();
                 arrModel[N].DGJYBHGX = dtTemp.Rows[N]["DGJYBHGX"] == DBNull.Value ? "" : dtTemp.Rows[N]["DGJYBHGX"].ToString();
          }

          dtTemp.Dispose();

          return arrModel;
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList(string p_strWhere)
      {
          return GetModelList(p_strWhere, "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList(string p_strWhere, string p_strOrder)
      {
          return GetModelList(p_strWhere, p_strOrder, -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList(int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList("", "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList(string p_strWhere, int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList(p_strWhere, "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public RESULT_CHASISS_MANUAL[] GetModelList()
      {
          return GetModelList("", "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          p_dtData.Clear();

          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
              m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
              m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
              m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from RESULT_CHASISS_MANUAL";
          if(p_strWhere.Trim().Length > 0)
          {
              strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
              strSql += " order by " + p_strOrder;
          }

          if(p_intPageSize > 0)
          {
              DbHelper.GetTable(strSql, ref p_dtData, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
              DbHelper.GetTable(strSql, ref p_dtData);
          }
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere)
       {
           GetModelList(ref p_dtData, p_strWhere, "", -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder)
       {
           GetModelList(ref p_dtData, p_strWhere, p_strOrder, -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, "", "", p_intPageNumber, p_intPageSize);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, p_strWhere, "", p_intPageNumber, p_intPageSize);
       }
       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData)
       {
           GetModelList(ref p_dtData, "", "", -1, -1);
       }
   }
}
